/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable react/prop-types */
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
import React, { useState } from 'react';
import { CloseCircleFilled } from '@ant-design/icons';
import { ipcRenderer } from 'electron';
import './index.css';

function CloseBtn({ hide }) {
  return (
    <>
      {!hide && (
        <div
          style={{
            position: 'fixed',
            right: 12,
            top: 12,
            zIndex: 1200,
            cursor: 'pointer',
          }}
          onClick={() => {
            ipcRenderer.send('close', new Date().getTime());
          }}
        >
          <CloseCircleFilled style={{ cursor: 'pointer' }} />
        </div>
      )}

      <div
        className="drag"
        onDoubleClick={() => {
          ipcRenderer.send('max', new Date().getTime());
        }}
      />
    </>
  );
}

export default CloseBtn;
